// 属性描述符
var obj={
    a:2
}
console.log(Object.getOwnPropertyDescriptor(obj,"a"));
 //{
    // value: 2,
    // writable: true,  可写
    // enumerable: true,  可枚举
    // configurable: true  可配置
    // }
// 修改属性描述符
// 1. writable false
Object.defineProperty(obj,"a",{
    value:3,
    writable:false,
    configurable:true,
    enumerable:true,
})
console.log(obj.a);
console.log(Object.getOwnPropertyDescriptor(obj,"a"));
obj.a=1;// 不可写
console.log(obj.a);//3
// configurable false
Object.defineProperty(obj,"a",{
    value:4,
    writable:false,
    configurable:false,
    enumerable:true,
})
console.log(obj.a);//4
obj.a=5;
console.log(obj.a);//5 
/*Object.defineProperty(obj,"a",{
    value:6,
    writable:true,
    configurable:false,
    enumerable:true,
})*/// TypeError
delete obj.a;
console.log(obj.a);


